Make sure data is numeric
Get the clusters
# Get Kappa loss in order to print Kappa Loss Curves
# Calculate 1 - mean_kappa rounded to two decimals
mean_results$kappa_loss <- round(1 - mean_results$mean_kappa, 3)
for(t in techniques){
# Filter data for the current dataset and method
filtered_data <- subset(mean_results, technique == t & noise == 10)
# Create plot
p <- ggplot(filtered_data, aes(x = percentage, y = kappa_loss, color = factor(cluster))) +
geom_point() +
geom_line(aes(group = factor(cluster))) +
labs(x = "Percentage of altered instances", y = bquote(.(nabla ~ "Kappa")), " Kappa", color = "Cluster") +
ggtitle(paste("Technique: ", t, " Noise injected: ", 10)) +
theme_bw() +
scale_y_continuous(limits = c(0.0, 1), breaks = seq(0, 1, by = 0.1))
# Store plot in the list
plot_name <- paste(t, 10, sep = "_")
plot_list[[plot_name]] <- p
print(p)
}
for(t in techniques){
# Filter data for the current dataset and method
filtered_data <- subset(mean_results, technique == t & noise == 20)
# Create plot
p <- ggplot(filtered_data, aes(x = percentage, y = kappa_loss, color = factor(cluster))) +
geom_point() +
geom_line(aes(group = factor(cluster))) +
labs(x = "Percentage of altered instances", y = bquote(.(nabla ~ "Kappa")), " Kappa", color = "Cluster") +
ggtitle(paste("Technique: ", t, " Noise injected: ", 20)) +
theme_bw() +
scale_y_continuous(limits = c(0.0, 1), breaks = seq(0, 1, by = 0.1))
# Store plot in the list
plot_name <- paste(t, 20, sep = "_")
plot_list[[plot_name]] <- p
print(p)
}
for(t in techniques){
# Filter data for the current dataset and method
filtered_data <- subset(mean_results, technique == t & noise == 30)
# Create plot
p <- ggplot(filtered_data, aes(x = percentage, y = kappa_loss, color = factor(cluster))) +
geom_point() +
geom_line(aes(group = factor(cluster))) +
labs(x = "Percentage of altered instances", y = bquote(.(nabla ~ "Kappa")), " Kappa", color = "Cluster") +
ggtitle(paste("Technique: ", t, " Noise injected: ", 30)) +
theme_bw() +
scale_y_continuous(limits = c(0.0, 1), breaks = seq(0, 1, by = 0.1))
# Store plot in the list
plot_name <- paste(t, 30, sep = "_")
plot_list[[plot_name]] <- p
print(p)
}